﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using LX.Web.Excel;

namespace S4Store.Domain.NetMarketingKpiReport
{
    public class NetMarketingStoreReport : NetMarketingCommonReport
    {
        [Export("合计标题")]
        public override string HjTitle
        {
            get { return  "合计"; }
        }
        public NetMarketingStoreReport()
        {
            MediaReports = new List<NetMarketingMediaReport>();
        }

        public virtual List<NetMarketingMediaReport> MediaReports { get; set; }

        /// <summary>
        /// 获取信息目标
        /// </summary>
        [Export("获取信息目标")]
        public override int HQXXMB
        {
            get { return MediaReports.Sum(t => t.HQXXMB); }
        }
        /// <summary>
        /// 月度费用
        /// </summary>
        [Export("月度费用")]
        public override decimal YDFY
        {
            get { return MediaReports.Sum(t => t.YDFY); }
        }
        /// <summary>
        /// 计划发帖数
        /// </summary>
        [Export("计划发帖数")]
        public override int JHFTS
        {
            get { return MediaReports.Sum(t => t.JHFTS); }
        }
        /// <summary>
        /// 实际发帖数
        /// </summary>
        [Export("实际发帖数")]
        public override int FTS
        {
            get { return MediaReports.Sum(t => t.FTS); }
        }
        /// <summary>
        /// 点击数
        /// </summary>
        [Export("点击数")]
        public override int DJS
        {
            get { return MediaReports.Sum(t => t.DJS); }
        }
        /// <summary>
        /// 单击退出数
        /// </summary>
        [Export("单击退出数")]
        public override int DJTCS
        {
            get { return MediaReports.Sum(t => t.DJTCS); }
        }
        /// <summary>
        /// 获取信息数
        /// </summary>
        [Export("获取信息数")]
        public override int HQXXS
        {
            get { return MediaReports.Sum(t => t.HQXXS); }
        }
        /// <summary>
        /// 主动来电数
        /// </summary>
        [Export("主动来电数")]
        public override int ZDLDS
        {
            get { return MediaReports.Sum(t => t.ZDLDS); }
        }
        /// <summary>
        /// 邀约来店数
        /// </summary>
        [Export("邀约来店数")]
        public override int YYLDS
        {
            get { return MediaReports.Sum(t => t.YYLDS); }
        }

        /// <summary>
        /// 营销资金执行率
        /// </summary>
        [Export("营销资金执行率", Format = "{0}%")]
        public decimal YXZJZXLV
        {
            get {
                if (this.NetMarketingKpiMonthConfig.YDYS == 0) return 0;
                return YDFY * 100 / NetMarketingKpiMonthConfig.YDYS;
            }
        }
        /// <summary>
        /// 资金投入比
        /// </summary>
        [Export("资金投入比", Format = "{0}%")]
        public override decimal ZJTRB
        {
            get
            {
                return 100;
            }
        }

        /// <summary>
        /// 发帖执行率
        /// </summary>
        [Export("发帖执行率", Format = "{0}%")]
        public override decimal FTZXLV
        {
                get { return MediaReports.AverageOrDefault(t => t.FTZXLV); }
           
        }
        /// <summary>
        /// 单击退出率
        /// </summary>
        [Export("单击退出率", Format = "{0}%")]
        public override decimal DJTCLV
        {
            get { return MediaReports.AverageOrDefault(t => t.DJTCLV); }
        }
        /// <summary>
        /// 获取信息比
        /// </summary>
        [Export("获取信息比", Format = "{0}%")]
        public override decimal HQXXB
        {
            get
            {
                return 100;
            }
        }
        /// <summary>
        /// 获得电话比
        /// </summary>
        [Export("获得电话比", Format = "{0}%")]
        public override decimal HDDHB
        {
            get
            {
                return 100;
            }
        }
    }
}
